package com.glsc.ngateway.common.base.domain.mysql.gateway.ldap;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.time.LocalDateTime;


@NoArgsConstructor
@Data
@Entity
@Table(name = "t_ldap_department_visit_system")
public class DepartmentVisitSystem {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int")
    private Integer id;

    @Column(name = "system_id", columnDefinition = "varchar(1024) not null")
    private String systemId;

    @Column(name = "comptitle", length = 200)
    private String comptitle;

    @Column(name = "department", columnDefinition = "varchar(128) not null")
    private String department;

    @ApiModelProperty(value = "更新人姓名")
    @Column(name = "update_name", columnDefinition = "varchar(30) comment '更新人姓名'")
    String updateName;

    @ApiModelProperty(value = "更新人账号oa")
    @Column(name = "update_account", columnDefinition = "varchar(30) comment '更新人账号oa'")
    String updateAccount;

    @ApiModelProperty(value = "更新时间")
    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;

    @Transient
    public int pageNo;

    @Transient
    public int pageSize;

}
